home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d902.lha / Less / Source / source.lha / help.c < prev    next >
C/C++ Source or Header  |  1993-01-21  |  4KB  |  108 lines

  1. #include "less.h"
  2.  
  3. extern char editor[];
  4.  
  5. /* Prototypes for functions defined in help.c */
  6.  
  7. static void help0 __PROTO((void));
  8. static void help1 __PROTO((void));
  9.  
  10.  
  11. /*
  12.  * Display some help.
  13.  * Help is in two pages.
  14.  */
  15. #ifdef __STDC__
  16. static void help0 (void)
  17. #else
  18.         static void
  19. help0()
  20. #endif
  21. {
  22.         ttputs("f,SPACE,^V  *Forward one screen.\n");
  23.         ttputs("b,B         *Backward one screen.\n");
  24.         ttputs("e,j,^N,CR   *Forward N lines, default 1.\n");
  25.         ttputs("y,k,^P,BS   *Backward N lines, default 1.\n");
  26.         ttputs("d           *Forward N lines,  \\ default half screen or\n");
  27.         ttputs("u           *Backward N lines, / last N to d or u command.\n");
  28.         ttputs("r            Repaint screen.\n");
  29.         ttputs("g, <        *Go to line N, default 1.\n");
  30.         ttputs("G, >        *Like g, but default is last line in file.\n");
  31.         ttputs("=            Show current file name\n");
  32.         ttputs("/pattern    *Search forward for N-th occurence of pattern.\n");
  33.         ttputs("?pattern    *Search backward for N-th occurence of pattern.\n");
  34.         ttputs("n           *Repeat previous search (for N-th occurence).\n");
  35.         ttputs("q,Q          Exit.\n");
  36. }
  37.  
  38. #ifdef __STDC__
  39. static void help1 (void)
  40. #else
  41.         static void
  42. help1()
  43. #endif
  44. {
  45.         char message[100];
  46.         extern char all_options[];
  47.  
  48.         ttputs("R            Repaint screen, discarding buffered input.\n");
  49.         ttputs("p, %        *Position to N percent into the file.\n");
  50.         ttputs("m<letter>    Mark the current position with <letter>.\n");
  51.         ttputs("'<letter>    Return to a previously marked position.\n");
  52.         ttputs("''           Return to previous position.\n");
  53.         sprintf(message,
  54.            "-X           Toggle a flag (one of \"%s\").\n",  all_options);
  55.         ttputs(message);
  56.         ttputs("E [file]     Examine a new file.\n");
  57.         ttputs("N           *Examine the next file (from the command line).\n");
  58.         ttputs("P           *Examine the previous file (from command line).\n");
  59.         ttputs("V            Print version number.\n");
  60. #if SHELL_ESCAPE
  61.         ttputs("!command     Passes the command to a CLI to be executed.\n");
  62. #endif
  63. #if EDITOR
  64.         sprintf(message,
  65.              "v            Edit the current file (default editor:%s).\n",
  66.                                 editor);
  67.         ttputs(message);
  68. #endif
  69.         ttputs("Cursor Keys *Up/Down: by pages; Left/Right: by lines.\n");
  70.         ttputs("Shft Crsr   *Up/Down: by pages; Left/Right: by half-pages.\n");
  71.         ttputs("Help Key    *This screen.\n");
  72.         error("");
  73. }
  74.  
  75. #ifdef __STDC__
  76. void help (void)
  77. #else
  78.         public void
  79. help()
  80. #endif
  81. {
  82.         extern int sc_height, sc_width;
  83.         register int i;
  84.  
  85.         for (i = 0;  i < 2;  i++)
  86.         {
  87.                 clear();
  88.                 so_enter();
  89.                 ttputs(Ver); ttputs ( "\n" );
  90.                 ttputs("R. Zarling rayz@csustan.EDU");
  91.                 so_exit();
  92.  
  93.                 ttputs("\n\nCommands marked with * may be preceeded by a number, N.\n\n");
  94.  
  95.                 switch (i)
  96.                 {
  97.                 case 0:         help0();
  98.                                 if ( sc_height < 35 || sc_width < 60 )
  99.                                 {
  100.                                     error("More help...");
  101.                                     break;
  102.                                 }
  103.                                 /* else vvv fall through vvv */
  104.                 case 1:         help1(); return;
  105.                 }
  106.         }
  107. }
  108.